package waggle.client.bean;

import java.util.Set;

public class User implements java.io.Serializable {

	private Integer id;
	private String firstName;
	private String lastName;
	private String openId;
	private String email;
	private Boolean approved;
	private Integer vetter;
	private Integer dataProvider;
	private String institution;
	private String passwordHash;
	private String sessionId;
	private Set<User> friends;
	private Set<Role> roles;

	public User() {
	}

	public User(String firstName, String lastName, String openId, String email,
			Boolean approved, Integer vetter, Integer dataProvider,
			String institution) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.openId = openId;
		this.email = email;
		this.approved = approved;
		this.vetter = vetter;
		this.dataProvider = dataProvider;
		this.institution = institution;
	}

	public boolean equals(Object obj) {
		if (obj == null || !(obj instanceof User)) {
			return false;
		}
		User compare = (User) obj;
		return id.equals(compare.id);
	}

	public Boolean getApproved() {
		return this.approved;
	}

	public Integer getDataProvider() {
		return this.dataProvider;
	}

	public String getEmail() {
		return this.email;
	}

	public String getFirstName() {
		return this.firstName;
	}

	public Set<User> getFriends() {
		return friends;
	}

	public Integer getId() {
		return this.id;
	}

	public String getInstitution() {
		return this.institution;
	}

	public String getLastName() {
		return this.lastName;
	}

	public String getOpenId() {
		return this.openId;
	}

	public String getPasswordHash() {
		return passwordHash;
	}

	/**
	 * @return the roles
	 */
	public Set<Role> getRoles() {
		return roles;
	}

	public String getSessionId() {
		return sessionId;
	}

	public Integer getVetter() {
		return this.vetter;
	}

	public int hashCode() {
		if (id == null) {
			return 0;
		}
		return id;
	}

	public void setApproved(Boolean approved) {
		this.approved = approved;
	}

	public void setDataProvider(Integer dataProvider) {
		this.dataProvider = dataProvider;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setFriends(Set<User> friends) {
		this.friends = friends;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public void setInstitution(String institution) {
		this.institution = institution;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public void setPasswordHash(String passwordHash) {
		this.passwordHash = passwordHash;
	}

	/**
	 * @param roles
	 *            the roles to set
	 */
	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	public void setVetter(Integer vetter) {
		this.vetter = vetter;
	}
}